package com.share.stastics.controller;

import com.share.common.core.domain.R;
import com.share.common.core.exception.ServiceException;
import com.share.common.core.web.controller.BaseController;
import com.share.common.core.web.domain.AjaxResult;
import com.share.user.api.RemoteUserInfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author ZhouShuang
 * @version 17
 * @Title
 * @date 2025/10/27 上午9:37
 */
@Tag(name = "AI数据统计")
@RestController
@RequestMapping("/sta")
@RequiredArgsConstructor
public class UserStasticsController extends BaseController {
    private final RemoteUserInfoService remoteUserInfoService;

    @GetMapping("/userCount")
    public AjaxResult userCount(){
        R<Map<String, Object>> r = remoteUserInfoService.getUserCount();
        if(R.FAIL == r.getCode()){
            throw new ServiceException(r.getMsg());
        }
        Map<String, Object> data = r.getData();
        return success(data);
    }

}
